package execption;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

public class ThrowDemo {
    public static void main(String[] args) {
        Student zs=new Student();
        try {
            zs.setAge(1000);
        } catch (IllegalAgeException e) {
            e.printStackTrace();
        }
        System.out.println("年龄"+zs.getAge()+"岁");







        /*
        try {
            FileInputStream fis=new FileInputStream("dat.txt");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
*/






       /* Student zs=new Student();
        try {
            zs.setAge(1000);
            System.out.println("年龄"+zs.getAge()+"岁");
        }catch (RuntimeException e){
            System.out.println("年龄不合法");
        }*/
    }
}
